package com.model;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.TableMapping;

@SuppressWarnings("serial")
public class Users extends Model<Users> {

	// 该变量为全局常量，只能用来做数据的操作，如果要做数据载体，需要new对象后setter
	public static final Users dao = new Users();

	// 查询所有用户,并分页显示
	public Page<Users> usersPaginate(int pageNumber, int pageSize, String sort, String order) {
		String table = TableMapping.me().getTable(Users.class).getName();
		return paginate(pageNumber, pageSize, "select *",
				"from " + table + " order by " + sort + " " + order);
	}
}
